<!-- 分类配置 -->
<script lang="ts">
export default {
  name: "banglingjuclassify",
};
</script>
<template>
  <div class="page-box h100 display-flex czbj">
    <p class="title-label mb10">
      分类配置
    </p>
    <div>
      <dxtable :formJson="formJson" :headBtn="headBtn" :dataJson="dataJson" :portUrl="portUrl" :qx="qx" ref="databale">
      </dxtable>
    </div>


  </div>
</template>
<script lang='ts' setup>
import { rowDark } from "naive-ui/es/legacy-grid/styles";
import dxtable from "../../components/util/dxtable.vue";
import sort from "../../components/util/sort.vue";
import { dxget, dxpost, qurl, hf, transferTimeYMDHm } from "../../util/index";
import { h, ref, reactive, onBeforeUpdate } from "vue";
const props = defineProps({
  pup: { type: String },
});
const showModal = ref(false)
const videourl = ref()
let headBtn = [];
const zdList = ref()
const databale = ref();
const typeli = ref([])
const kfdser = ref([])
const initeer = () => {
  databale.value.initDataExpose();
};
const emit = defineEmits(["callBack"]);
// 弹窗公用该列表
let dataJson = reactive([
  {
    title: "id",
    key: "id",
    width: 50,
  },

  {
    title: "名称",
    search: true, // 是否在搜索栏展示
    key: "name",
    width: 400,
  },
  {
    title: "类别",
    search: true, // 是否在搜索栏展示
    type: "select",
    options: [],
    key: "type",
    render: (row) => {
      try {
        return kfdser.value.filter(a => a.value == row.type)[0].label
      } catch (e) {

      }
    }
  }, {
    title: "快捷提示",
    key: "tab",
    render: (row) => {
      row.tab=  row.tab.split(',')
      return row.tab
    }
  },
  {
    title: "排序",
    width: 100,
    render(row) {
      row.databaseName = "banglingjuclassify";
      return h(sort, {
        row,
        onCallBack: () => {
          initeer();
        },
      });
    },
  },
  {
    title: "添加时间",
    key: "addTime",
    width: "140",
    type: "daterange",
  },
]);
let portUrl = "bangpaotui/classify";
const qx = {
  DeletePermissionID: "banglingjuclassifydel", //删除
  EditPermissionIdentifier: "banglingjuclassifybj", // 编辑
  NewPermissionIdentifier: "banglingjuclassifyxz", // 新建
  ViewPermissionID: "banglingjuclassifyck", // 查看
};

let formJson = reactive([


  {
    title: "名称",
    key: "name",
    type: "input",
    span: 24,
    required: true,
  },
  {
    title: "图标名称",
    key: "icon",
    type: "input",
    required: true,
  }, {
    title: "分类",
    key: "type",
    type: "select",
    options: [],
    required: true,
  }, {
    title: "公告",
    key: "notice",
    type: "input",
    span: 24,
  }, {
    title: "快捷提示",
    key: "tab",
    type: "Tags",
    val: [],
    span: 24,
  },
  {
    title: "协议",
    key: "agreement",
    type: "textarea",
    required: true,
  },
])





const getxjyxblzlfl = async () => {
  const { data }: any = await dxget("dxgjAdmin/getzd", { name: 'btdfl' })
  // data.map(a => {
  //   a.value = a.label
  // })
  dataJson[2].options = [
    {
      label: "全部",
      value: ""
    },
    ...data
  ]
  kfdser.value = data
  console.log(data);
  formJson[2].options = data
}
getxjyxblzlfl()

</script>
  
  
  